package Cards;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Card implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    private String code;
    private String clan;
    private String type;
    private String name;
    private int cost;
    private int power;
    private int actualDamage;
    private int currentDamage;
    private Effect effect;

    public Card() {
        this.code = "";
        this.clan = "";
        this.type = "";
        this.name = "";
        this.cost = 0;
        this.power = 0;
        this.actualDamage = 0;
        this.currentDamage = 0;
        this.effect = new Effect("0", "", "");
    }

    public Card(String code,
                String clan,
                String type,
                String name,
                int cost,
                int power,
                int damage,
                String cEffect,
                String p1Effect,
                String p2Effect) {
        this.code = code;
        this.clan = clan;
        this.type = type;
        this.name = name;
        this.cost = cost;
        this.power = power;
        this.actualDamage = damage;
        this.currentDamage = damage;
        this.effect = new Effect(cEffect, p1Effect, p2Effect);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

       
    public String getClan() {
        return clan;
    }

    public void setClan(String clan) {
        this.clan = clan;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCost() {
        return cost;
    }

    public void setCost(int cost) {
        this.cost = cost;
    }

    public int getPower() {
        return power;
    }

    public void setPower(int power) {
        this.power = power;
    }

    public int getActualDamage() {
        return actualDamage;
    }

    public void setActualDamage(int actualDamage) {
        this.actualDamage = actualDamage;
    }

    public int getCurrentDamage() {
        return currentDamage;
    }

    public void setCurrentDamage(int currentDamage) {
        this.currentDamage = currentDamage;
    }

    public Effect getEffect() {
        return effect;
    }

    public void setEffect(Effect effect) {
        this.effect = effect;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (code != null ? code.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Card)) {
            return false;
        }
        Card other = (Card) object;
        if ((this.code == null && other.code != null) || (this.code != null && !this.code.equals(other.code))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return '[' + getCode() + "] " + name;
    }
    
}
